package main

import(
	//"fmt"
	log "github.com/jeanphorn/log4go"
)

type DbDao struct{

}


func (this *DbDao) GetUserProxy(Uid string) (Proxyname string, Ancestorlist string){
        
	rows, rErr := Db.Query("select a.`name` as proxyname, a.account, b.ancestor, depth from bc_VipTree b,bc_User a where b.descendant = ? and a.uid = b.ancestor", Uid)
	if rErr != nil {
		log.Error(rErr)
		return
	}
	//fmt.Println(Db.LastSql)
    Proxyname = "";
    Ancestorlist = "";
	for _, data := range rows{		
        //fmt.Printf("%T", data["depth"])
		if data["depth"].(int64) == 1 {
			Proxyname = data["proxyname"].(string) + "(" + data["account"].(string) + ")"
		}
		
		Ancestorlist = Ancestorlist + data["ancestor"].(string) + "|";
		
	}
	return
}